package mediator.createRole
{
	import mediator.BaseMediator;
	
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	
	import proxy.createRole.CreateRoleProxy;
	
	import view.createRole.ICreateRoleComp;

	/**
	 *创建角色 
	 * @author zn
	 * 
	 */	
	public class CreateRoleCompMediator extends BaseMediator implements IMediator
	{
		public static const NAME:String="CreateRoleCompMediator";

		public static const SHOW_NOTE:String="show" + NAME + "Note";

		public static const DESTROY_NOTE:String="destroy" + NAME + "Note";

		public function CreateRoleCompMediator(viewComponent:Object=null)
		{
			super(NAME, viewComponent);
			
			facade.registerProxy(new CreateRoleProxy());
		}
		
		public override function onRemove():void
		{
			facade.removeProxy(CreateRoleProxy.NAME);
			super.onRemove();
		}

		
		/**
		 *添加要监听的消息
		 * @return
		 *
		 */
		override public function listNotificationInterests():Array
		{
			return [ DESTROY_NOTE];
		}

		/**
		 *消息处理
		 * @param note
		 *
		 */
		override public function handleNotification(note:INotification):void
		{
			switch (note.getName())
			{
				case DESTROY_NOTE:
				{
					//销毁对象
					destroy();
					break;
				}
			}
		}

		/**
		 *获取界面
		 * @return
		 *
		 */
		protected function get comp():ICreateRoleComp
		{
			return viewComponent as ICreateRoleComp;
		}
	}
}